<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

use Magento\Paypal\Block\Express\InContext\Minicart\Button;

/**
 * @var \Magento\Paypal\Block\Express\InContext\Minicart\Button $block
 */
$config = [
    'Magento_Paypal/js/in-context/button' => [
        'id' => $block->getContainerId(),
        'paypalButton' => Button::PAYPAL_BUTTON_ID,
        'addToCartSelector' => $block->getAddToCartSelector()
    ]
];

?>
<!-- Google Code for check out with paypal Conversion Page
In your html page, add the snippet and call
goog_report_conversion when someone clicks on the
chosen link or button. -->
<script type="text/javascript">
  /* <![CDATA[ */
  goog_snippet_vars = function() {
    var w = window;
    w.google_conversion_id = 846331111;
    w.google_conversion_label = "Ocv5CIDFvnQQ5_nHkwM";
    w.google_remarketing_only = false;
  }
  // DO NOT CHANGE THE CODE BELOW.
  goog_report_conversion = function(url) {
    goog_snippet_vars();
    window.google_conversion_format = "3";
    var opt = new Object();
    opt.onload_callback = function() {
    if (typeof(url) != 'undefined') {
      window.location = url;
    }
  }
  var conv_handler = window['google_trackConversion'];
  if (typeof(conv_handler) == 'function') {
    conv_handler(opt);
  }
}
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion_async.js"></script>
<!-- Google Code for check out with paypal Conversion Page End-->
<div data-mage-init='<?php /* @noEscape */ echo json_encode($config); ?>'
     class="paypal checkout paypal-logo <?php /* @noEscape */ echo $block->getContainerId(); ?>-container" onclick="goog_report_conversion()">
    <a id="<?php /* @noEscape */ echo $block->getContainerId(); ?>" href="#">
        <img class="paypal-button-hidden"
             src="<?php /* @noEscape */ echo $block->getImageUrl();/*$this->getViewFileUrl('images/paypal.jpg'); */?>"
             alt="Check out with PayPal" />
    </a>
</div>
